#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    int singleNumber(vector<int>& nums) {
        int i = 0;
        int ret = 0;
        for (i = 0; i < 32; i++)
        {
            int val = 0;
            for (int e : nums)
            {
                val += e >> i & 1;
            }
            ret |= val % 3 << i;
        }
        return ret;
    }
};